package p18.p1816;

import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;

public class TreeMapDemo {
    public static void main(String[] args) {
        String s = "abcdefabvc";
        TreeMap<Character, Integer> map = new TreeMap<>();
        char[] ss = s.toCharArray();

        for (char c : ss
                ) {
            //System.out.println(map.get(c));
            if (map.get(c) == null) {
                map.put(c, 1);
            } else {
                Integer i = map.get(c);
                map.put(c, i + 1);
            }

        }
        Set<Character> set = map.keySet();
        for (Character in : set
                ) {
            Integer pi = map.get(in);
            System.out.println(in + "---" + pi);
        }
    }
}
